import type { RoleType } from "../role/types";

// 用户类型
export interface UserLoginRequest {
  username: string;
  password: string;
}

export interface UserLoginReponse extends ResponseData {
  data: string;
}

export interface UserEditResponse extends ResponseData {
  data: boolean;
}

export interface UserResponse extends ResponseData {
  data: UserType;
}

export interface UserType {
  id?: number;
  username?: string;
  password?: string;
  nickname?: string;
  avatar?: string;
  roles?: RoleType[];
  buttons?: string[];
  routes?: string[];
  token?: string;
}

export interface UserPageResponse extends ResponseData {
  data: UserPageType;
}

export interface UserPageType {
  total: number;
  records: UserType[];
}

export interface UserPageRequest {
  nickname: string;
  currentPage: number;
  pageSize: number;
}

export interface UserAllocRoleRequest {
  id: number;
  roles: RoleType[];
}

// 定义全部接口返回数据都拥有ts类型
interface ResponseData {
  code: number;
  message: string;
}
